import app
import requests

class employeeDemo():
    def __init__(self):
        self.url_add_employee = app.BASE_URL + "/api/sys/user"
        self.url_common_employee = app.BASE_URL + "/api/sys/user/{}"

    # 添加员工
    def add_employee(self, json_data):
        return requests.post(url=self.url_add_employee,json=json_data, headers=app.headers_data)

    # 修改
    def modify_employee(self, json_data, employee_id):
        return requests.put(url=self.url_common_employee.format(employee_id),json=json_data, headers=app.headers_data)

    # 查询
    def get_employee(self, employee_id):
        return requests.get(url=self.url_common_employee.format(employee_id), headers=app.headers_data)
    # 删除
    def delete_employee(self, employee_id):
        return requests.delete(url=self.url_common_employee.format(employee_id), headers=app.headers_data)